# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-cairo
_pkgname=pycairo
pkgver=1.18.2
pkgrel=6
pkgdesc='Python interface for cairo.'
url='https://pypi.org/project/pycairo/#files'
arch=('x86_64' 'aarch64')
license=('MIT' 'LGPL')
depends=('python2' 'cairo')
makedepends=('python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('279ea80413ba55d493d51455685da09afa1f5c45e2930c3fca3e417a8afe6645a0d8131201f79482de59e5ec56cfef62eac65ed88fe88866bfcc06503dcc59e0')

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  # for py3
  mv "$pkgdir/usr/include/$_pkgname" "$pkgdir/usr/include/${_pkgname}2"
  mv "$pkgdir/usr/lib/pkgconfig/${_pkgname}.pc" \
    "$pkgdir/usr/lib/pkgconfig/${_pkgname}2.pc"
}

